package acm.pta9;

import java.util.Scanner;

public class T1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        char[] chars = sc.nextLine().toCharArray();
        int i=0,j=0;
        while (i<chars.length){
            if (chars[i]=='6'){
                j++;
            }else {
                print6(j);
                j=0;
                System.out.print(chars[i]);
            }
            i++;
        }
        print6(j);
    }
    public static void print6(int j){
        if (j>9){
            System.out.print(27);
        }else if (j>3){
            System.out.print(9);
        }else if (j>0){
            while (j-->0){
                System.out.print(6);
            }
        }
    }
}
